package cs236369.webserver.examples;

public class DynamicLoad {

	public static void main(String[] args) throws Exception {
		
		B[] arr = new B[2];
		for (int i : new int[]{1, 2}) {
			arr[i-1] = (B)Class.forName("cs236369.webserver.examples.B1").getConstructor(String.class).newInstance("Hi !!");
			arr[i-1].speak();
		}
		// note that we can recv B1 and B2 class names as a string argument
		System.out.println(arr[0]==arr[1]);
	}
	
}
